<template>
  <div>
    <f7-block-title v-if="list.length>0">报名人员</f7-block-title>
    <f7-list media-list v-if="list.length>0">
      <f7-list-item v-for="item in list" :key="item.id" @click.stop="showAppliedPersons(item)">
        <div slot="media" class="media-portrait">
          <img :src="item.headimg_url"/>
        </div>
        <div slot="title">
          <span style="font-weight: bold;" v-if="from == 'dingding'">
            <span v-if="item.sign && item.sign.length == 1">
              {{item.sign[0].name + ' (微信：' + (item.nickname || '') + ')' }}
            </span>
            <span v-if="item.sign && item.sign.length > 1">
              {{ '微信：' + (item.nickname || '') + '，共 ' + (item.sign.length || 1) + ' 人' }}
            </span>
          </span>
          <span style="font-weight: bold;" v-if="from == 'wechat'">
            {{ (item.nickname || '') }}
            <span v-if="item.sign&&item.sign.length > 1">
              (共 {{ (item.sign.length || 1) + ' 人)' }}
            </span>
          </span>
        </div>
        <div slot="subtitle">
          报名时间：{{ item.join_time.trim().substr(0, 16) }}
          <f7-badge :color="from=='wechat'?'green':'blue'"
                    v-if="item.attend_time&&item.attend_time!=''">
            已签到
          </f7-badge>
        </div>
      </f7-list-item>
    </f7-list>
  </div>
</template>

<script>
  import Log from '../../mod/log.js';
  import strings from '../../assets/strings';
  import cordova from '../../js/cordova-app';

  import AlertUtils from '../../mod/utils.alert';

  import Storage from '../../mod/storage';
  import ToastUtils from '../../mod/utils.toast';
  import Utils from '../../js/mod.utils';
  import StringUtils from '../../js/mod.string';
  import ConstantUtils from '../../js/vue.constant';

  const name = "activity-apply-list>";
  const log = new Log(name);

  export default {
    props: ['from', 'list', 'queryData'],
    components: {},
    data() {
      return {
        name: name,
      };
    },
    methods: {
      onCreated() {
        let _this = this;
      },
      onMounted() {
        let _this = this;
      },
      showAppliedPersons(item) {
        let _this = this;
        console.log('_this.queryData', _this.queryData);
        Storage.sessionSet('activityApplyData', StringUtils.toStr(item));
        Utils.load(_this, '/dingding-activity-checkedlist/', {
          aid: _this.queryData.id,
        }, {});
      },
    },
    created() {
      this.onCreated();
    },
    mounted() {
      this.onMounted();
    },
  }
</script>

<style scoped>
</style>